#!/bin/bash

# 切换到指定目录
cd /opt/MVS/Samples/aarch64/Python/hksdkdemo-python-aarch64/Samples/aarch64/Python/MultiCameraGrabImage || {
    echo "无法切换到目录 /opt/MVS/Samples/aarch64/Python/hksdkdemo-python-aarch64/Samples/aarch64/Python/MultiCameraGrabImage，请检查路径是否正确！"
    exit 1
}

# 定义日志存储目录
LOG_DIR="./logs"

# 创建日志目录（如果不存在）
mkdir -p "$LOG_DIR"

# 启动 Python 主脚本
python3 MultiCameraGrabImage.py

# 提示脚本完成
# echo "Logging scripts started. Logs are saved in $LOG_DIR"
echo $! > "$PID_FILE"  # 保存后台进程的 PID 到文件

# 提示启动成功
echo "Python script started and running in background (PID: $(cat $PID_FILE)). Logs are saved in $LOG_DIR."
